import type { RouteLocationNormalized } from "vue-router";
import { useRoutePermission } from "@/store";

/** 权限检测 */
export const checkPermission = async (
  to: RouteLocationNormalized,
  // from: RouteLocationNormalized,
): Promise<boolean> => {
  // console.log("checkPermission to", to);
  // console.log("checkPermission from", from);

  const { checkNeedGoToAuthPage } = useRoutePermission();

  return !checkNeedGoToAuthPage(to);
};
